//
//  TopListCell.m
//  QQplayground
//
//  Created by zhangxy on 2018/6/28.
//  Copyright © 2018年 zhang. All rights reserved.
//

#import "TopListCell.h"
#import <SDWebImage/UIImageView+WebCache.h>

@implementation TopListCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    [_labNum setTextColor:UIColorFromRGB(TextWhiteColor)];
    _labNum.layer.cornerRadius = 10.0f;
    [_labNum setFont:FontSeventeen];
    _labNum.layer.masksToBounds = YES;
    [_labNum setTextAlignment:NSTextAlignmentCenter];
    [_labNum setBackgroundColor:UIColorFromRGB(BgYellowColor)];
    
    
    _imgAvatar.layer.cornerRadius = 45.0/2;
    _imgAvatar.layer.masksToBounds = YES;
    
    [_labName setTextColor:UIColorFromRGB(TextSizeEightColor)];
    [_labName setFont:FontFiftent];
    [_labName setTextAlignment:NSTextAlignmentLeft];
    [_labName setBackgroundColor:UIColor.clearColor];
    
    
    [_btnNum.titleLabel setFont:ListElevenFont];
    _btnNum.layer.cornerRadius = 4;
    _btnNum.layer.masksToBounds = YES;
    _btnNum.layer.borderColor = UIColorFromRGB(BorderLineColor).CGColor;
    _btnNum.layer.borderWidth = 1.0f;
    //[_btnNum setTitleColor:UIColorFromRGB(TextSizeOneColor) forState:0];
    _btnNum.titleLabel.textAlignment = NSTextAlignmentCenter;
    _btnNum.imageView.contentMode = UIViewContentModeCenter;
    [_btnNum setBackgroundColor:UIColorFromRGB(TextWhiteColor)];
    [_btnNum setTitleColor:UIColorFromRGB(TextSizeEightColor) forState:0];
    _btnNum.frame = CGRectMake(_btnNum.frame.origin.x - 10, _btnNum.frame.origin.y, _btnNum.frame.size.width + 20, _btnNum.frame.size.height + 2);
    //[_btnNum setImage:[UIImage imageNamed:@"热度"] forState:0];
}


-(void)dataToView:(User *) user row:(NSInteger ) row{
    [_labNum setText:convertIntToString((int)row + 4)];
    if(row>1){
        [_labNum setBackgroundColor:UIColorFromRGB(TextSizeEightColor)];
    }else{
        [_labNum setBackgroundColor:UIColorFromRGB(BgYellowColor)];
    }
    [_imgAvatar sd_setImageWithURL:[NSURL URLWithString:user.user_avatar]];
    [_labName setText:user.user_name];
    
    if(_type == 1){
        [_btnNum setTitle:user.count_like forState:0];
        [_btnNum setImage:[UIImage imageNamed:@"Combined_Shape"] forState:0];
    }
    else if(_type == 2){
        [_btnNum setTitle:user.user_gold forState:0];
    }else{
        [_btnNum setTitle:user.count_view forState:0];
        [_btnNum setImage:[UIImage imageNamed:@"热度"] forState:0];
    }
}

-(void)dataGoldToView:(ZZGoldTopEntity *)user row:(NSInteger)row{
    [_labNum setText:convertIntToString((int)row +4)];
    if(row>1){
        [_labNum setBackgroundColor:UIColorFromRGB(TextSizeEightColor)];
    }else{
        [_labNum setBackgroundColor:UIColorFromRGB(BgYellowColor)];
    }
    [_imgAvatar sd_setImageWithURL:[NSURL URLWithString:user.user_info.user_avatar]];
    [_labName setText:user.user_info.user_name];
    
    [_btnNum setTitle:user.now_value forState:0];
    [_btnNum setImage:[UIImage imageNamed:@"金币"] forState:0];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
